<div class="row"><div class="span10 offset1">	<?php echo flash_message();?>


<?php 

if (isset($categories) ) { 
if(count($categories)>0)
{	
	
	?>
	
<header>
<div class="row-fluid">			<h3 >Category Managament</h3>	

<?php 
echo form_open('category/index',array("class"=>"well form-search"));   
echo form_input('search',set_value('search','search'));
echo form_submit('submit',set_value('submit','search'));
echo form_fieldset_close();  
?>

</header>



<?php

	$tmpl = array (
                    'table_open'=> '<table class="tablesorter table table-bordered" cellspacing="0">',
              );

$this->table->set_template($tmpl); 
	
	
	foreach ($categories as $category) {
		$links = anchor('category/edit/' . $category->getId(), '<img src="'.base_url().'images/icn_edit.png" alt="Edit" />');
		$links .= anchor('category/delete/' . $category->getId(), '<img src="'.base_url().'images/icn_trash.png" alt="Trash" />',array('onclick'=>"return confirm('Are you sure want to delete this category?')"));
		$links = '<div class="btn-group"><a class="btn btn-primary" href="#"><i class="icon-list-alt icon-white"></i> Category</a><a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a><ul class="dropdown-menu">';		$links .= '<li>';  		$links .= anchor('category/edit/' . $category->getId(), '<i class="icon-pencil"></i> Edit');		$links .='</li>';		$links .= '<li>';  		$links .= anchor('category/delete/' . $category->getId(), '<i class="icon-trash"></i> Delete',array('onclick'=>"return confirm('Are you sure want to delete this category?')"));		$links .='</li>';					$links .= "<ul></div>";		$this -> table -> set_heading('Name', 'Clean Name', 'Actions');
		$this -> table -> add_row($category->getName(), $category->getNameCLean(),$links);
	}

	echo $this -> table -> generate();
	
	if (PAGINATION_ENABLED && isset($this -> pagination) )
	{        
		echo '<div class="pagination_container">' . $this -> pagination -> create_links() . '</div>';
	}
?>
<div class="other_actions">
	<?php echo anchor('category/create','Add Category');?>
</div>	

<?php 
}}
 else{
 	?>
	 <p  style="padding-left: 10px">no result found.... <?php echo anchor('category/create','Create a Category');?></p> 
<?php
 }
 ?></div>
</div>